Address Auto- completE API

Get verified and standardized addresses from free-form entries

We built our Address Autocomplete API for use in address autocomplete inputs. For example, for validating addresses in HTML forms. When users enter free-form addresses, the API returns verified and standardized addresses. The API returns address suggestions as you type. So, if you type "Munic ", the API will return "Munich, Bavaria, Germany " and more address suggestions to choose from. Use our API to autofill addresses at the street, city, postcode, and other address levels. You can also set biases and filters to make your search even more accurate.

|
  • Rue du stade La marsa, Tunisie
  • Rue du stade La marsa, Tunisie
  • Rue du stade La marsa, Tunisie
Try Our Address Autocomplete API Enter an address here to try location autocomplete for yourself:
|
  • Rue du stade La marsa, Tunisie
  • Rue du stade La marsa, Tunisie
  • Rue du stade La marsa, Tunisie

Use cases

Choose a city or postcode on a website (city level)

Say you want your users to be able to search for results near a location, for example:
Choose a city to show hotels nearby or Enter a postcode to show the closest shops or transportation stops You can use the Address Autocomplete API with type parameters (such as type=city or type=postcode) to let your users choose a location. Check our NPM Libraries that will help you add Address Autocomplete to your website or app. Here's an example of a bounding box and coordinates that can be used to show results on a map and allow users to search for what they need:

datasource {} 4 keys
old_name: "Lutèce "
country: "France "
country_code: "fr "
region: "Metropolitan France "
state: "Ile-de-France "
city: "Paris "
lon: 2.3483915
lat: 48.8534951
formatted: "Paris, Ile-de-France, France "
address_line1: "Paris "
address_line2: "Ile-de-France, France "
category: "administrative "

Choose a location to show on a map (roughly location level)

You have a map and you want to use address autocomplete input to zoom the map to the selected location. In this case it’s not important to find the exact house or building. The goal is to show surroundings.
This is useful for:

  • Showing places nearby
  • Analyzing the location
  • Choosing route waypoints and visualizing the route
  • Choosing a location for isoline
You can add Address Autocomplete with our NPM Libraries, or you can develop your own control using Address Autocomplete API. Check out this JSFiddle demo for an example. Using Leaflet map? No problem. We've created a Leaflet map plugin that lets you add Address Autocomplete input with a few lines of code.

Collect postal addresses

If you need to collect a customer’s postal address, for example to ship some goods, our API can help. This task is a bit different from choosing cities or locations. In this case you need to collect the exact address and exact location. The problem you might run into here is that there is no geo database, either open or proprietary (such as Google Maps) that includes all existing addresses. And new buildings and roads are being added all the time. Our API can help you even if a place is not mapped up to the building level, but only the street level. It assumes the house number is correct even if it can't check it, and shows you confidence level coefficients to help you assess the results. So you need to allow adding addresses even if they are not suggested by address autocomplete. What do you do? Well, we've added in @geoapify/geocoder-autocomplete possibility to show in the dropdown list non verified streets and house numbers. The non-verified part of the address is shown in red:

The API also shows you the appropriate confidence level coefficients: {
"confidence ":0.3535714285714286,
"confidence_city_level ":1,
"confidence_street_level ":0.7071428571428572,
"match_type ":"match_by_street "
}
Anoher option is to ask your customer to show you their exact location on a map. Check out this JSFiddle for a demonstration of how to do that.

Address collection forms

You can also collect postal addresses by asking users to fill an address form. You can ask them to fill in the country, city, postcode, street and house number in separate inputs. With address collection forms, you need to keep in mind that some addresses might not be in databases. It's important to allow adding non-verified house numbers and streets. Here is a JSFiddle that demonstrates how to create an address collection form:

Features and capabilities

Get well-formatted addresses and coordinates from an address string or its part

Our API returns well-formatted addresses, including separate address components like house number, street, postcode (or zipcode), city, state, country and latitude/longitude coordinates. Here's an example of an Autocomplete API URL for the "Gabelsbergerstr 14, Regensburg " address string:

https://api.tmaps.tn/v1/geocode/autocomplete?text=Gabelsbergerstr%2014%2C%20Regensburg&format=json&apiKey=YOUR_API_KEY

Please note that the address should be URL-encoded as part of the URL.

The API returns all the locations corresponding to the address in the original query including parsed address, formatted addresses, and components:

results [] 4 items

0: {} 19 keys
country_code:"de "
housenumber:"14 b "
street:"Gabelsbergerstraße "
country:"Germany "
datasource {} 4 keys

postcode:"93047 "
state:"Bavaria "
district:"Regensburg "
city:"Regensburg "
lon:12.105486
lat:49.015503
suburb:"Kasernenviertel "
formatted:"Gabelsbergerstraße 14 b, 93047 Regensburg, Germany "
address_line1:"Gabelsbergerstraße 14 b "
address_line2:"93047 Regensburg, Germany "
category:"building "
result_type:"building "

The result object also contains place ids. You can pass the ids to Place Details API to get building geometries, contact details, website, and other information.

Autofill postcodes (or zip codes) and other address levels

Our API accepts location type as a parameter, so you can create inputs for postcode, city, country, and more. Here’s an example of a postcode autocomplete URL, searching postcodes in Germany that start with "863 ":

https://api.tmaps.tn/v1/geocode/autocomplete?text=863&type=postcode&filter=countrycode:de&format=json&limit=20&apiKey=YOUR_API_KEY

The default number of returned results is 5. But you can increase the limit to get more results.

This API request found 7 postcodes starting with "863:

results [] 7 items
0: {} 19 keys
1: {} 19 keys
2: {} 19 keys
3: {} 19 keys
4: {} 19 keys
5: {} 19 keys
query :{} 1 key tex: “863”

Easy to use and integrate

The Address Autocomplete API works via HTTP GET requests, so it’s cross-platform and you can integrate it into any website or app. The API returns a JSON object which map libraries can easily visualize. Works with MapLibre GL, Leaflet, OpenLayers, and others. Each address suggestion contains a formatted address for both the complete address and address parts. These can be used to set a visual focus for the primary and secondary address parts:

Ready-to-use NPM libraries

With @geoapify libraries, you can add an address autocomplete field to your website in just a few minutes:

@geoapify/geocoder-autocomplete
@geoapify/react-geocoder-autocomplete
@@geoapify/angular-geocoder-autocomplete
@geoapify/leaflet-address-search-plugin
Our libraries are open source, so you can use them in their current form, or as an example when developing your own implementations.

Multilanguage support

Address Autocomplete API supports multiple languages, so you can show your customers address suggestions in their own language. Here’s a URL example of Address Autocomplete API with language parameter:

https://api.tmaps.tn/v1/geocode/autocomplete?text=Berlin%20central&limit=5&lang=de&apiKey=YOUR_API_KEY

You can get the user language settings, for example, from the browser language preferences:

const language = window.navigator.userLanguage || window.navigator.language;

Use biases and filters to search nearby

Autocomplete API allows you to set preferred locations by view box, within a radius, or within a country. Use it to “search nearby”, “search within the visible area”, or limit your search to a specific area. Try the filters and biases for yourself in our Address Autocomplete Playground.

Place details with Place Details API

Autocomplete API returns a place ID that you can use with our Place Details API to get detailed information about the place, the building geometry, or boundaries. For example, here are the boundaries of the City of London:

Affordable and permissive

We built the Geoapify Address Autocomplete API on open-data sources. That means you get permissive conditions - you can store and cache your address results and suggestions - and affordable prices. Our Free Tier includes up to 3000 address autocomplete requests per day (~ 90000 requests/month).

Getting started

Getting started with the Address Autocomplete API is easy
1. Register and get an API key

You'll need an API Key to use the API. To get one:

  • Register on MyProject Geoapify page
  • Create a new project
  • Switch to the "API keys" page and get an API key
2. Add an address input field with Autocomplete function

Our API returns address suggestions for the address provided. But you also want to have it work when a user types an address input. As they type, address suggestions come up. However, you don't always have to do it from scratch. We've created NPM libraries that will help you add the address input to your website just by adding a few lines of code. You can use these packages with or without a map library (Maplibre GL, Leaflet, OpenLayers). You can also customize the look and feel of the components with provided styles or with custom CSS.

FAQ

  • Create vector and raster maps you can use as a base-map layer for Leaflet, MapLibre GL, OpenLayers, QGIS, and other map libraries and GIS. Or use our Static Maps API to generate map images and map markers. Choose between different map styles and colors to match your app and website design.
  • Create vector and raster maps you can use as a base-map layer for Leaflet, MapLibre GL, OpenLayers, QGIS, and other map libraries and GIS. Or use our Static Maps API to generate map images and map markers. Choose between different map styles and colors to match your app and website design.

  • Create vector and raster maps you can use as a base-map layer for Leaflet, MapLibre GL, OpenLayers, QGIS, and other map libraries and GIS. Or use our Static Maps API to generate map images and map markers. Choose between different map styles and colors to match your app and website design.
  • Create vector and raster maps you can use as a base-map layer for Leaflet, MapLibre GL, OpenLayers, QGIS, and other map libraries and GIS. Or use our Static Maps API to generate map images and map markers. Choose between different map styles and colors to match your app and website design.

  • Create vector and raster maps you can use as a base-map layer for Leaflet, MapLibre GL, OpenLayers, QGIS, and other map libraries and GIS. Or use our Static Maps API to generate map images and map markers. Choose between different map styles and colors to match your app and website design.
  • Create vector and raster maps you can use as a base-map layer for Leaflet, MapLibre GL, OpenLayers, QGIS, and other map libraries and GIS. Or use our Static Maps API to generate map images and map markers. Choose between different map styles and colors to match your app and website design.